<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    @include('comm/layuiCommStyle')
    @include('comm/comm')
    @include('comm/upload')
    <title>报表上传</title>
</head>
<body>




<div style="padding: 15px;">
    <blockquote class="layui-elem-quote">
        报表上传
    </blockquote>
</div>

<div class="layui-container">
    <a href="/admins/report/filelist">
        <button class="layui-btn layui-btn-lg">
            <i class="layui-icon" style="font-size: 40px;">&#xe630;</i>查看要同步的文件
        </button>
    </a>
</div>

<div class="layui-container">
    <div style="height: 300px;">
        <form enctype="multipart/form-data" method="post">
            <label class="control-label">Select File</label>
            <input id="input-b5" name="input-b5" type="file" multiple>
            {{ csrf_field() }}
        </form>
    </div>
</div>


</body>
<script>

    $(document).ready(function(){
        $("#input-b5").fileinput({
            showCaption: false,
            theme: 'fa',
            language: 'zh',
            uploadUrl: './upload',
            allowedFileExtensions: ['jpg', 'png', 'gif','xls']
        });
        $("#input-b5").on("fileuploaded", function (event, data, previewId, index)  {

            var result = data.response; //后台返回的json
            if(result.msg==1)
            {
                alert(result.name);
                window.location.href="/admins/report/filelist";
            }
            else {
                alert("上传失败了");
            }

        });

    });
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });

</script>

</html>